package org.example.session;

import org.example.config.Configuration;
import org.example.datasource.Environment;
import org.example.executor.Executor;

import javax.sql.DataSource;
import java.sql.SQLException;

public class DefaultSqlSessionFactory  implements SqlSessionFactory{
    private Configuration configuration;

    public DefaultSqlSessionFactory(Configuration configuration) {
        this.configuration = configuration;
    }

    @Override
    public SqlSession openSession(boolean autoCommit) {
        final Executor executor = configuration.newSimpleExecutor();
        return new DefaultSqlSession(configuration, executor,autoCommit);
    }
}
